﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Qianwei.Model;
using Qianwei.Biz;
using Qianwei.Common.Extension;

namespace Qianwei.Web
{
    public partial class HomePicture : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                SetContent();
            }
        }

        private void SetContent()
        {
            int pid = Request["pid"].TryInt();
            if (pid == 0)
            {
                lcontenttitle.Text = "未知标题";
                lcontent.Text = "未知内容";
                return;
            }
            IList<home_page_picture> homepicinfo = HomePagePictureManager.Instance.QueryHomePagePicture(string.Format("Home_Page_Id={0}", pid));
            if (homepicinfo == null || homepicinfo.Count == 0)
            {
                lcontenttitle.Text = "未知标题";
                lcontent.Text = "未知内容";
                return;
            }
            home_page_picture homepic = homepicinfo.First();
            lcontenttitle.Text = homepic.Picture_Des;
            lcontent.Text = homepic.Page_Content;
        }
    }
}